//
//  XCCycleParams.swift
//  XCCycleBanner
//
//  Created by edy on 2023/7/10.
//

import UIKit

// MARK: - Property list
public class XCCycleParams {

    public var isAutoPlay: Bool = true
    
    public var isBounces: Bool = true
        
    public var isPagingEnabled: Bool = true
    
    public var contentInset = UIEdgeInsets.zero
    
    public var timeInterval: TimeInterval = 5.0
    
    public var cycleWay: CycleWay = .forward
        
    internal var currentRollingDirection: RollingDirection = .right
}

// MARK: - Public enum
public extension XCCycleParams {
    
    enum CycleWay {
        case forward
        case rollingBack
    }
    
    enum RollingDirection {
        case right
        case left
    }
}

// MARK: - Set function
public extension XCCycleParams {
    
    func isAutoPlay(_ isAutoPlay: Bool) -> XCCycleParams {
        self.isAutoPlay = isAutoPlay
        return self
    }
    
    func isBounces(_ isBounces: Bool) -> XCCycleParams {
        self.isBounces = isBounces
        return self
    }
    
    func isPagingEnabled(_ isPagingEnabled: Bool) -> XCCycleParams {
        self.isPagingEnabled = isPagingEnabled
        return self
    }
    
    func contentInset(_ contentInset: UIEdgeInsets) -> XCCycleParams {
        self.contentInset = contentInset
        return self
    }
    
    func timeInterval(_ timeInterval: TimeInterval) -> XCCycleParams {
        self.timeInterval = timeInterval
        return self
    }
    
    func cycleWay(_ cycleWay: CycleWay) -> XCCycleParams {
        self.cycleWay = cycleWay
        return self
    }
    
    internal func currentRollingDirection(_ currentRollingDirection: RollingDirection) -> XCCycleParams {
        self.currentRollingDirection = currentRollingDirection
        return self
    }

}
